package com.liuxinlong.push;

import com.liuxinlong.websocket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 消息推送到前端服务api实现
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2023-01-29
 */
@Slf4j
@Service
public class MessagePushServiceImpl implements MessagePushService{
    private WebSocketServer webSocketServer;

    @Override
    public void pushMessage(String messageInfo,String userId) {
        try {
            webSocketServer.sendInfo(messageInfo,userId);
        } catch (Exception e) {
            log.error("send message to {} error!",userId);
        }
    }
}
